//USART
//Crystal= 4 MHz; Baud Rate = 1.2k; SPBRG = 51,
//Crystal= 20 MHz; Baud Rate = 115.2k; SPBRG = 2,


#include<p18F4580.h>
#include <usart.h>
#include <delays.h>

void main()
{
  TRISC = 0x00;	
  OpenUSART(USART_TX_INT_OFF & 
			USART_RX_INT_OFF & 
			USART_ASYNCH_MODE & 
			USART_EIGHT_BIT &   
			USART_CONT_RX & 
			USART_BRGH_LOW, 2);
			
//BAUD RATE FORMULAS:	
//SYNC = 0, BRGH = 0, BRG16 = 0
//baud rate= FOSC / (64 * (spbrg + 1)) 
//baud rate=   4M / (64 * (51 + 1)) 	= 1200

//BAUD RATE = 1200; spbrg = 51
//BAUD RATE = 9600; spbrg = 6

			 
  while(1)
  { 
      putrsUSART("Hello World!");
	  Delay10KTCYx(100);
      //CloseUSART(); 
  }
}